home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.3d26 source
/
tn3270
/
prt.c
< prev
next >
Wrap
Text File
|
1991-01-21
|
3KB
|
131 lines
/*
* tn3270 for the Macintosh Source Code
* Brown University Computing and Information Services
* Version 2.3d21, January 17, 1991
* Copyright (c) 1988, 1989, 1990, 1991 by Brown University and by
* Peter John DiCamillo.
*
* Permission is granted to any individual or institution to use, copy,
* or redistribute the binary version of this software and its
* documentation provided this notice and the copyright notices are
* retained. Permission is granted to any individual or non-profit
* institution to use, copy, modify, or redistribute the source files
* of this software provided this notice and the copyright notices are
* retained. This software may not be distributed for profit, either
* in original form or in derivative works, nor can the source be
* distributed to other than an individual or a non-profit institution.
* Any individual or group interested in seeing and/or using these
* source files but who are prevented from doing so by the above
* constraints should contact Don Wolfe, Assistant Vice-President for
* Computer Systems at Brown University, (401) 863-7250, for possible
* software licensing of the source developed at Brown.
*
* Brown University and Peter John DiCamillo make no representations
* about the suitability of this software for any purpose.
*
* BROWN UNIVERSITY AND PETER JOHN DICAMILLO GIVE NO WARRANTY, EITHER
* EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
* INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#define __SEG__ vmxfer
#include "maclib.h"
#include "termdef.h"
#include "globals.h"
extern short hpixsize, vpixsize;
pgsetup()
{
if (hPrint == 0) {
SysBeep(1);
return;
}
if (prtinit == 0) {
PrOpen();
PrintDefault(hPrint);
prtinit = 1;
}
PrStlDialog(hPrint);
}
prscreen()
{
TPPrPort prtport;
GrafPtr gp;
TPrStatus prStatus;
if (hPrint == 0) {
SysBeep(1);
return;
}
if (prtinit == 0) {
PrOpen();
PrintDefault(hPrint);
prtinit = 1;
}
if (!PrJobDialog(hPrint)) return;
/* main printing code (not loop, since only one page) */
GetPort(&gp);
setdoctitle("3270 Screen Dump");
prtport = PrOpenDoc(hPrint, 0L, 0L);
if (PrError() == noErr) {
PrOpenPage(prtport, 0L); /* start new page */
if (PrError() == noErr) prtdraw();
PrClosePage(prtport);
}
PrCloseDoc(prtport);
if (((*hPrint)->prJob.bJDocLoop == bSpoolLoop) && (PrError() == noErr))
PrPicFile(hPrint, 0L, 0L, 0L, &prStatus);
if (PrError() != noErr) stoperr(305);
SetPort(gp);
}
prtdraw()
{
char colorsave;
GrafPtr gp;
TextFont(stdfont);
PicComment(155, 0, 0L); /* line layout off */
/* set constants for 12-point, and if page is not big enough,
use 9-point instead */
setmode(cur_rows, cur_cols, 12, 0);
TextSize(12);
GetPort(&gp);
if ((hpixsize > (gp->portRect).right) ||
(vpixsize > (gp->portRect).bottom)) {
setmode(cur_rows, cur_cols, 9, 0);
TextSize(9);
}
/* set colormac flag according to printing grafport */
colorsave = colormac;
colormac = ((gp->portBits.rowBytes & 0xc000) == 0xc000);
writescr(1);
/* restore settings by calling setmode */
setmode(cur_rows, cur_cols, cur_ptsize, ses_windmax);
/* restore colormac flag */
colormac = colorsave;
}
setdoctitle(s)
char * s;
{
WindowPtr wp;
char titlesave[256];
wp = FrontWindow();
if (wp == 0) return;
GetWTitle(wp, titlesave);
SetWTitle(wp, s);
PrValidate(hPrint);
SetWTitle(wp, titlesave);
}